﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Meqs.Entity;
using Meqs.Logic.Interface;
using System.Collections.Generic;
public partial class Score_Education_AreaManage_UpdateSituation : System.Web.UI.Page
{
    /// <summary>
    /// 局级考试的修改界面
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            List<GlobalCauseInfo> list = new List<GlobalCauseInfo>();
            list.Add(new GlobalCauseInfo());
            repeatSubject.DataSource = list;
            repeatSubject.DataBind();
        }
    }

    public string GetTD()
    {
        int index = 5;
        string s = "";
        IGlobalCauseInfoLogic subjectLogic = Container<IGlobalCauseInfoLogic>.Instance;
        Hashtable table = new Hashtable();
        table.Add("IsEffect", 1);
        List<GlobalCauseInfo> list = (List<GlobalCauseInfo>)subjectLogic.FindAll(table);
        foreach (GlobalCauseInfo item in list)
        {
            if (index % 5 == 0)
                s += "<tr>";
            s += "<td style='border:0px solid #ffffff; height:24px;line-height:24px;text-align:left;word-wrap:none;word-break:keep-all;overflow:hidden'>"
                + "<NOBR><input type='checkbox' value=" + item.RID + " />" + item.CauseName + "</td></NOBR>";
            if (index % 5 == 4)
                s += "</tr>";
            index++;
        }

        s += "</tr>";
        return s;
    }


    /// <summary>
    /// 更新考试数据
    /// </summary>
    /// <param name="exam"></param>
    /// <param name="listSubjectId"></param>
    /// <returns></returns>
    [System.Web.Services.WebMethod]
    public static int UpdateEduExam(ExamsEducation exam, List<string> listSubjectId)
    {
        IExamsEducationLogic eduExamLogic = Container<IExamsEducationLogic>.Instance;
        List<CauseInfo> list = new List<CauseInfo>();
        foreach (string id in listSubjectId)
        {
            CauseInfo causeInfo = new CauseInfo();
            causeInfo.RID = Convert.ToInt32(id);
            list.Add(causeInfo);
        }

        int n = eduExamLogic.UpdateEudExam(exam, list);
        return n;
    }
}
